/**
 * Created by renzhiqiang on 17/8/12.
 */
import React ,{Component, PropTypes, PureComponent} from "react";

import { createStore,applyMiddleware,combineReducers} from 'redux'
import Counter from './components/couter'
import "babel-polyfill";
import { push } from 'react-router-redux';
import createSagaMiddleware from 'redux-saga';
import DevTools from './../DevTool/index'

import sagaMonitor from './sagaMotoner/index';
import reducer from './reduer'
import rootSaga from './sage'

const sagaMiddleware = createSagaMiddleware();
const store = createStore(
    reducer,
    applyMiddleware(sagaMiddleware)
);
sagaMiddleware.run(rootSaga);

const action = type => store.dispatch({type});

module.exports  = React.createClass({
    render: function() {
        return <div>
            <Counter
            value={store.getState()}
            onIncrement={() => action(push('/home'))}
            onDecrement={() => action('DECREMENT')}
            onIncrementIfOdd={() => action('INCREMENT_IF_ODD')}
            onIncrementAsync={() => action('INCREMENT_ASYNC')} />,</div>;
    }
});
store.subscribe(function (data) {
    console.info('111');
});
